# <
# __lt__
# less than
print("================================================================================" * 3)

# <=
# __le__
# less or equal
print("================================================================================" * 3)

# >
# __gt__
# great than
print("================================================================================" * 3)

# >=
# __ge__
# great or equal
print("================================================================================" * 3)

# ==
# __eq__
# equal
print("================================================================================" * 3)

# !=
# __ne__
# not equal
print("================================================================================" * 3)


class S(str):

    def __lt__(self, other):
        return len(self) < len(other)

    def __gt__(self, other):
        return len(self) > len(other)

    def __eq__(self, other):
        return len(self) == len(other)


s_1 = S("FishC")
s_2 = S("fishc")
print(s_1 < s_2)  # False
print(s_1 > s_2)  # False
print(s_1 == s_2)  # True

print("================================================================================" * 3)
print(s_1 != s_2)  # True TODO 为什么还是True 呢 ？ 因为我们只是拦截了 __eq__ ，并没有拦截 __ne__ 所以 不等于 != 还是使用的是父类 str 中的实现

print("================================================================================" * 3)


class Ss(str):

    def __lt__(self, other):
        return len(self) < len(other)

    def __gt__(self, other):
        return len(self) > len(other)

    def __eq__(self, other):
        return len(self) == len(other)

    __le__ = None
    __ge__ = None
    __ne__ = None


ss1 = Ss("FishC")
ss2 = Ss("fishc")

# 报错：因为它的 __ne__ 方法是 None
# print(ss1 != ss2)  # TypeError: 'NoneType' object is not callable
